#!/bin/sh
# postinst framework for openpanel packages
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#

case "$1" in
    configure)
	if [ ! -e "/etc/ssl/private/ssl-openpanel.key" ]; then
		ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/private/ssl-openpanel.key
	fi
	if [ ! -e "/etc/ssl/certs/ssl-openpanel.pem" ]; then
		ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/certs/ssl-openpanel.pem
	fi
	
	update-rc.d openpanel-ssl start 72 2 3 4 5 . stop 72 0 1 6 . > /dev/null
	/etc/init.d/openpanel-ssl start

    ;;

    abort-upgrade|abort-remove|abort-deconfigure)

    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0


